<?php

/**
 * Created by PhpStorm.
 * User: lyang
 * Date: 2016/12/31
 * Time: 16:03
 */
class Model
{
    public function M($model_name_argv,$argv){
        $model_name = explode("_",$model_name_argv);
        if(isset($model_name[1])){
            $name = $model_name[1];
        }else{
            return '';
        }
        $model = $model_name[0];
        $uri = function($name){
            return sprintf("%s/model/%s.php",ROOT,$name);
        };
        $path = $uri($model);
        if(is_file($path)){
             require_once "$path";
             return call_user_func($model_name_argv,$argv);
        }else{
            return '';
        }
    }
}